package master.usefulClosures;

import java.awt.Color;
import java.awt.Graphics;

import master.ComplexNumber;

/**
 * A way of providing real time displays of manipulations on complex numbers
 * @author Luke Dobinson
 *
 */
public abstract class ComplexNumberClosure extends ComplexNumber {

	/**
	 * Pointers to variables to act on
	 */
	protected ComplexNumber [] complexNumbers;//pointers to variables to act on
	
	/**
	 * Constructor
	 * @param complexNumbers
	 */
	public ComplexNumberClosure(ComplexNumber ...complexNumbers ) {
		super(0, 0);
		this.complexNumbers = complexNumbers;
	}
	
	/**
	 * retrieve the real value of the result of the calculation
	 */
	public float getReal(){
		return this.function(complexNumbers).getReal();
	}
	/**
	 * retrieve the imaginary value of the result of the calculation
	 */
	public float getImaginary(){
		return this.function(complexNumbers).getImaginary();
	}
	
	
	/**
	 * Return a complexNumber based on the function
	 * @param c
	 * @return
	 */
	public abstract ComplexNumber function(ComplexNumber ... complexNumbers);
	
}
